/**
 * @Author 12629
 * @Description：方法重载 overload
 */
public class Test2 {

    public static int fac(int n) {
        if(n == 1) {
            return 1;
        }
        return n * fac(n-1);
    }

    public static void print(int n) {
        if(n < 10) {
            System.out.println(n);
        }else {
            print(n/10);
            System.out.println(n%10);
        }
    }

    public static int sum(int n) {
        if(n == 1) {
            return 1;
        }
        return n + sum(n-1);
    }


    public static int sumNum(int n) {
        if(n < 10) {
            return n;
        }

        return n%10 + sumNum(n/10);
    }

    public static int fib(int n) {
        if(n == 1 || n == 2) {
            return 1;
        }
        return fib(n-1) + fib(n-2);
    }

    public static int fib2(int n) {
        if(n == 1 || n == 2) {
            return 1;
        }
        int f1 = 1;
        int f2 = 1;
        int f3 = -1;
        for (int i = 3; i <= n; i++) {
            f3 = f1+f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }

    public static void main(String[] args) {
        //System.out.println(fib(41));
        System.out.println("==============");
        System.out.println(fib2(41));

    }

    public static int add(int a,int b) {
        return a+b;
    }

   /* public static int add(int a,int b) {
        return a+b;
    }*/

    public static int add(int a,int b,int c) {
        return a+b;
    }

    public static double add(double a,double b) {
        return a+b;
    }

    public static void main1(String[] args) {

        System.out.println("hello: "+args);



        System.out.println(add(1, 2, 3));


        int a = 1;
        int b = 2;
        System.out.println(add(a, b));


        double c = 1.1;
        double d = 2.2;
        System.out.println(add(c, d));

    }
}
